<?php

namespace App\Admin\Controllers\cert;

use App\Models\CertProvince;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class CertProvinceController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '省份';

    protected $description = '最好不要删除';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new CertProvince);

        $grid->column('cert_province_id', __('Cert province id'));
        $grid->column('province', __('Province'));
        $grid->column('min', __('缩写'));
        $grid->column('created_at', __('Created at'));
        $grid->column('updated_at', __('Updated at'));
        $grid->column('deleted_at', __('Deleted at'));

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(CertProvince::findOrFail($id));

        $show->field('cert_province_id', __('Cert province id'));
        $show->field('province', __('Province'));
        $show->field('min', __('Min'));
        $show->field('created_at', __('Created at'));
        $show->field('updated_at', __('Updated at'));
        $show->field('deleted_at', __('Deleted at'));

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new CertProvince);

        $form->text('province', __('省份：福建'));
        $form->text('min', __('缩写：闽'));

        return $form;
    }
}
